package com.hc.music.controller;

import com.hc.music.common.R;
import com.hc.music.entity.SongList;
import com.hc.music.service.SongListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("songList")
public class SongListController {
    @Autowired
    SongListService songListService;

    @RequestMapping("addSongList")
    public R addSongList(@RequestBody SongList songList){
        return songListService.addSongList(songList);
    }

    @RequestMapping("allSongList")
    public R allSongList(){
        return songListService.allSongList();
    }

    @PostMapping("updateSongListImg")
    public R updateSongListImg(@RequestParam("file")MultipartFile file ,@RequestParam("id") Integer id){
        return songListService.updateSongListImg(file,id);
    }

    @RequestMapping("updateSongList")
    public R updateSongList(@RequestBody SongList songList){
        return songListService.updateSongListMsg(songList);
    }

    @RequestMapping("deleteSongList")
    public R deleteSongList(@RequestParam Integer id){
        return songListService.deleteSongList(id);
    }

    @RequestMapping("orderByStyle")
    public R orderByStyle(@RequestParam String style){
        return songListService.likeStyle(style);
    }

    @RequestMapping("selectByLikeTitle")
    public R selectByLikeTitle(@RequestParam String title){
        return songListService.likeTitle(title);
    }
}
